package com.hqd.ch03.v22.aop.support;

import com.hqd.ch03.v22.aop.Pointcut;
import com.hqd.ch03.v22.aopalliance.aop.Advice;

public class DefaultPointcutAdvisor extends AbstractGenericPointcutAdvisor {
    private Pointcut pointcut = Pointcut.TRUE;

    public DefaultPointcutAdvisor() {
    }

    public DefaultPointcutAdvisor(Advice advice) {
        this(Pointcut.TRUE, advice);
    }

    public DefaultPointcutAdvisor(Pointcut pointcut, Advice advice) {
        this.pointcut = pointcut;
        setAdvice(advice);
    }

    @Override
    public Pointcut getPointcut() {
        return this.pointcut;
    }

    public void setPointcut(Pointcut pointcut) {
        this.pointcut = (pointcut != null ? pointcut : Pointcut.TRUE);
    }
}
